﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CLFramework.Attributes
{

    [AttributeUsage(AttributeTargets.Method)]
    public class MethodDefinitionAttribute : Attribute
    {
        public MethodDefinitionAttribute(object value)
        {
            Value = value;
        }

        public MethodDefinitionAttribute(object value, string name)
            : this(value)
        {
            Name = name;
        }

        public string Name { get; private set; }

        private object value;
        public object Value
        {
            get
            {
                if (value == null)
                    EnsureValue();

                return value;
            }
            protected set
            {
                this.value = value;
            }
        }

        protected virtual void EnsureValue()
        {
        }
    }
}
